package com.zym.init.model.query;

import com.zym.init.core.annotation.EnumRange;
import com.zym.init.enums.PermissionStatusEnum;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.groups.Default;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * 权限查询对象
 */
@EqualsAndHashCode(callSuper = true)
@Data
public class PermissionQuery extends PageQuery {

    /**
     * ID
     */
    @NotNull(message = "权限ID不能为空", groups = {Update.class})
    private Long permissionId;

    /**
     * 权限名称
     */
    @NotEmpty(message = "权限名称不能为空", groups = {Add.class})
    private String permissionName;

    /**
     * 权限代码
     */
    @NotEmpty(message = "权限代码不能为空", groups = {Add.class})
    private String permissionCode;

    /**
     * 权限描述
     */
    private String permissionDesc;

    /**
     * 状态：(1:启用[active] 2:禁用[inactive])
     */
    @EnumRange(message = "权限状态错误", enumClass = PermissionStatusEnum.class, enumValidMethod = "isValidCode", groups = {Update.class, Add.class})
    @NotEmpty(message = "状态不能为空", groups = {Add.class})
    private String status;

    /**
     * 新增校验组
     */
    public interface Add extends Default {
    }

    /**
     * 更新校验组
     */
    public interface Update extends Default {
    }
}
